﻿@model CustomerUserSettingsModel
@using Grand.Domain.Customers;

<script>
    $(document).ready(function () {
        $("#@Html.FieldIdFor(model => model.CustomerSettings.UsernamesEnabled)").click(toggleUsername);
        toggleUsername();
    });

    function toggleUsername() {
        if ($('#@Html.FieldIdFor(model => model.CustomerSettings.UsernamesEnabled)').is(':checked')) {
            $('#pnlAllowUsersToChangeUsernames').show();
            $('#pnlCheckUsernameAvailability').show();
        }
        else {
            $('#pnlAllowUsersToChangeUsernames').hide();
            $('#pnlCheckUsernameAvailability').hide();
        }
    }
</script>
<div class="form-horizontal">
    <div class="form-body">
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.AllowUsersToChangeEmail" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.AllowUsersToChangeEmail" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.AllowUsersToChangeEmail"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.UsernamesEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.UsernamesEnabled" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.UsernamesEnabled"></span>
            </div>
        </div>
        <div class="form-group" id="pnlAllowUsersToChangeUsernames">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.AllowUsersToChangeUsernames" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.AllowUsersToChangeUsernames" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.AllowUsersToChangeUsernames"></span>
            </div>
        </div>
        <div class="form-group" id="pnlCheckUsernameAvailability">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.CheckUsernameAvailabilityEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.CheckUsernameAvailabilityEnabled" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.CheckUsernameAvailabilityEnabled"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.UserRegistrationType" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-select asp-for="CustomerSettings.UserRegistrationType" asp-items="((UserRegistrationType)Model.CustomerSettings.UserRegistrationType).ToSelectList(Context)" />
                <span asp-validation-for="CustomerSettings.UserRegistrationType"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.GeoEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.GeoEnabled" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.GeoEnabled"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.ShowCustomersLocation" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.ShowCustomersLocation" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.ShowCustomersLocation"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.ShowCustomersJoinDate" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.ShowCustomersJoinDate" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.ShowCustomersJoinDate"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.AllowViewingProfiles" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.AllowViewingProfiles" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.AllowViewingProfiles"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.AllowUsersToDeleteAccount" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.AllowUsersToDeleteAccount" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.AllowUsersToDeleteAccount"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.AllowUsersToExportData" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.AllowUsersToExportData" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.AllowUsersToExportData"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.NotifyNewCustomerRegistration" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.NotifyNewCustomerRegistration" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.NotifyNewCustomerRegistration"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideDownloadableProductsTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideDownloadableProductsTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideDownloadableProductsTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideBackInStockSubscriptionsTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideBackInStockSubscriptionsTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideBackInStockSubscriptionsTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideAuctionsTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideAuctionsTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideAuctionsTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideNotesTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideNotesTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideNotesTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideReviewsTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideReviewsTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideReviewsTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideCoursesTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideCoursesTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideCoursesTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideSubaccountsTab" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideSubaccountsTab" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideSubaccountsTab"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.CustomerNameFormat" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-select asp-for="CustomerSettings.CustomerNameFormat" asp-items="((CustomerNameFormat)Model.CustomerSettings.CustomerNameFormat).ToSelectList(Context)" />
                <span asp-validation-for="CustomerSettings.CustomerNameFormat"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.DefaultPasswordFormat" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-select asp-for="CustomerSettings.DefaultPasswordFormat" asp-items="((PasswordFormat)Model.CustomerSettings.DefaultPasswordFormat).ToSelectList(Context)" />
                <span asp-validation-for="CustomerSettings.DefaultPasswordFormat"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.PasswordMinLength" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.PasswordMinLength" />
                <span asp-validation-for="CustomerSettings.PasswordMinLength"></span>
            </div>
        </div>
        <div class="form-group">

            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.PasswordRegularExpression" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.PasswordRegularExpression" />
                <span asp-validation-for="CustomerSettings.PasswordRegularExpression"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="note note-info">
                You can use this regex: <br>
                ^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@@$%^&*-]).{8,}$<br>
                This regex will enforce these rules:<br>
                • At least one upper case english letter<br>
                • At least one lower case english letter<br>
                • At least one digit<br>
                • At least one special character<br>
                • Minimum 8 in length
            </div>
        </div>

        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.PasswordLifetime" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.PasswordLifetime" />
                <span asp-validation-for="CustomerSettings.PasswordLifetime"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.UnduplicatedPasswordsNumber" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.UnduplicatedPasswordsNumber" />
                <span asp-validation-for="CustomerSettings.UnduplicatedPasswordsNumber"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.PasswordRecoveryLinkDaysValid" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.PasswordRecoveryLinkDaysValid" />
                <span asp-validation-for="CustomerSettings.PasswordRecoveryLinkDaysValid"></span>
            </div>
        </div>

        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.FailedPasswordAllowedAttempts" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.FailedPasswordAllowedAttempts" />
                <span asp-validation-for="CustomerSettings.FailedPasswordAllowedAttempts"></span>
                <script>
	                $(document).ready(function () {
	                    $("#@Html.FieldIdFor(model => model.CustomerSettings.FailedPasswordAllowedAttempts)").blur(toggleFailedPasswordAllowedAttempts);
			                toggleFailedPasswordAllowedAttempts();
		                });

		                function toggleFailedPasswordAllowedAttempts() {
		                    var failedPasswordAllowedAttempts = $("#@Html.FieldIdFor(model => model.CustomerSettings.FailedPasswordAllowedAttempts)").data("kendoNumericTextBox");
			                if (failedPasswordAllowedAttempts.value($("#value").val()) > 0) {
				                $('#pnlFailedPasswordLockoutMinutes').show();
			                } else {
				                $('#pnlFailedPasswordLockoutMinutes').hide();
			                }
		                }
                </script>
            </div>
        </div>
        <div class="form-group" id="pnlFailedPasswordLockoutMinutes">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.FailedPasswordLockoutMinutes" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-input asp-for="CustomerSettings.FailedPasswordLockoutMinutes" />
                <span asp-validation-for="CustomerSettings.FailedPasswordLockoutMinutes"></span>
            </div>
        </div>

        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.HideNewsletterBlock" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.HideNewsletterBlock" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.HideNewsletterBlock"></span>
            </div>
        </div>
        <div class="form-group" id="pnlNewsletterBlockAllowToUnsubscribe">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.NewsletterBlockAllowToUnsubscribe" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.NewsletterBlockAllowToUnsubscribe" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.NewsletterBlockAllowToUnsubscribe"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.RegistrationFreeShipping" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.RegistrationFreeShipping" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.RegistrationFreeShipping"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.StoreLastVisitedPage" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.StoreLastVisitedPage" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.StoreLastVisitedPage"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.TwoFactorAuthenticationEnabled" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="CustomerSettings.TwoFactorAuthenticationEnabled" />
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="CustomerSettings.TwoFactorAuthenticationEnabled"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="col-8 col-md-4 col-sm-4 text-right">
                <admin-label asp-for="CustomerSettings.TwoFactorAuthenticationType" class="control-label" />
            </div>
            <div class="col-4 col-md-8 col-sm-8">
                <admin-select asp-for="CustomerSettings.TwoFactorAuthenticationType" asp-items="((TwoFactorAuthenticationType)Model.CustomerSettings.TwoFactorAuthenticationType).ToSelectList(Context)" />
                <span asp-validation-for="CustomerSettings.TwoFactorAuthenticationType"></span>
            </div>
        </div>
    </div>
</div>